<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
<title>${name_china}管理-新建${name_china}</title>
 <%@include file="/common/head.jsp" %>

 <!-- 上传下载插件 -->
 <link href="<%=request.getContextPath()%>/static/plugin/uploadify/style/uploadify.css" rel="stylesheet">
 <script src="<%=request.getContextPath()%>/static/plugin/uploadify/js/jquery.uploadify.js"></script>

<!-- 时间日期插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/My97DatePicker/WdatePicker.js"></script>

<!-- 下拉树插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/zTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/zTree/js/jquery.ztree.all-3.5.min.js"></script>

<!--富文本插件 -->
<script src="<%=request.getContextPath()%>/static/plugin/ckeditor/ckeditor.js"></script>


<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/image-server/style/style.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/webuploader.css">
<link href="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/uploader.css" rel="stylesheet">
<!-- <script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/jquery-3.2.1.min.js"></script> -->
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/plugin/webuploader-0.1.5/common.js"></script>

</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>新建${name_china}</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="addForm" method="post">
  <div id="left" style="width:80%;float:left">
   
	 <div class="form-wrapper">
	 
		<div class="h4 distance-double">
	        <span class="h4-title"><i class="icon icon-setting"></i>商品SPU</span>
	        <span class="h4-border"></span>
	    </div>
	    
	    <input type="hidden" name="categoryId" value="${categoryId}"/>
	    
        <input type="hidden" id="productId" name="productId"/>
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>排序号</p>
	        <input type="text" id="reorder" name="reorder" class="summer-input summer-validatebox" value="${reorder}" data-validatebox="validType:['required','noNegativeNumber']"/> 
	     </div>
	     
	    <!--   <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>首页位置</p>
	        <input type="text" id="indexLocation" name="indexLocation" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div> -->
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品名称</p>
	        <input type="text" id="name" name="name" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[300]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品品牌</p>
	        <input type="text" id="brand" name="brand" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[300]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否精品</p>
	        <input type="text" id="isJingping" name="isJingping" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否包邮</p>
	        <input type="text" id="isFreePost" name="isFreePost" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否七天退换货</p>
	        <input type="text" id="isServenBack" name="isServenBack" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">商品来源</p>
	        <input type="text" id="laiyuan" name="laiyuan" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[500]']"/> 
	     </div>
	   
         
          <div class="form-cont">
	        <p class="form-cont-title">上市时间</p>
	        <input type="text" id="marketUpTime" name="marketUpTime" class="summer-input summer-validatebox"  onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-validatebox="validType:['maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品主图</p>
	        <input type="hidden" id="mainImageUrl" name="mainImageUrl"/> 
		    <!--  <input type="text" id="mainImageUrl" name="mainImageUrl" class="summer-input summer-validatebox"  data-validatebox="validType:['maxLength[300]']"/> -->
		    <!-- 文件上传 -->
	     	<div >
				<div id="mainImageUrlFileList" class="uploader-list"></div>
				<div id="mainImageUrlFilePicker">选择图片</div>
				<p style="color:red">建议高：159px；宽：159px</p>
			</div>
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品的轮播图</p>
	        <input type="hidden" id="bannerImageUrls" name="bannerImageUrls"/> 
	     	<!-- 文件上传 -->
	     	<div >
				<div id="fileList" class="uploader-list"></div>
				<div id="filePicker">选择图片</div>
				<p style="color:red">建议高：188px；宽：375px</p>
			</div>
	     </div>
	     
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品详情图</p>
	        <input type="hidden" id="detailImageUrls" name="detailImageUrls"/>
	       <!--  <input type="text" id="detailImageUrls" name="detailImageUrls" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[1000]']"/> --> 
	       <!-- 文件上传 -->
	     	<div >
				<div id="detailImageUrlsFileList" class="uploader-list"></div>
				<div id="detailImageUrlsFilePicker">选择图片</div>
				<p style="color:red">建议高：无限制；宽：375px</p>
			</div>
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>供货价格</p>
	        <input type="text" id="productGonghuoPrice" name="productGonghuoPrice" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>优惠红包</p>
	        <input type="text" id="productHongbao" name="productHongbao" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>红包开始时间</p>
	        <input type="text" id="startTime" name="startTime" class=" summer-input summer-validatebox"  data-validatebox="validType:['required']"  onFocus="var afterTime=$dp.$('stopTime');WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function(){afterTime.focus();},minDate:'#F{(\'%y-%M-%d\')}',maxDate:'#F{$dp.$D(\'stopTime\')}'})" /> 
	     </div>
	     
	    <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>红包结束时间</p>
	        <input type="text" id="stopTime" name="stopTime" class="summer-input" data-validatebox="validType:['required']" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startTime\')}'})"/> 
	     </div>
	     
	     
	      <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>佣金比例(例：10)</p>
	        <input type="text" id="marketProfitPercent" name="marketProfitPercent" class="summer-input summer-validatebox"  data-validatebox="validType:['required','noNegativeNumber']"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">推荐理由</p>
	        <textarea class="summer-textarea" id="note" name="note"></textarea>
	     </div>
	     
	     <div class="h4 distance-double">
	        <span class="h4-title"><i class="icon icon-setting"></i>商品SKU</span>
	        <span class="h4-border"></span>
	    </div>
	   <!--  <a class="btn btn-primary" onclick="addSku();">添加款式</a> -->
	    
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>是否为主商品</p>
	        <input type="text" class="summer-input"  value="是"  id="isMainView" readonly="readonly"/>
	        <input type="hidden" id="isMain" name="isMain" value="1" class="summer-input summer-validatebox" readonly="readonly"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <input type="hidden" id="productPropertys" name="productPropertys"/>
	    
	     <div class="form-cont" id="afterProperty0">
	        <p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品属性</p>
	        <input type="text" id="productProperty0" name="productProperty0" class="summer-input"/>
	        
            <input type="text" id="productPropertyValue0" name="productPropertyValue0" class="summer-input"/>
            <a onclick="addProperty()"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_add.png"></a>
	     </div>
	    
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>库存</p>
	        <input type="text" id="productInventory" name="productInventory" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <div class="form-cont" id="afterSku">
	        <p class="form-cont-title"><span class="field-required">*</span>商品编码</p>
	        <input type="text" id="skuNum" name="skuNum" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[100]']"/> 
	        <div >
				<p style="color:red">如不填写，可点击<a onclick="autoCreate()">自动生成</a></p>
			</div>
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品价格</p>
	        <input type="text" id="productOrginPrice" name="productOrginPrice" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div>
	     
	     <!-- <div class="form-cont">
	        <p class="form-cont-title"><span class="field-required">*</span>商品现价</p>
	        <input type="text" id="productPrice" name="productPrice" class="summer-input summer-validatebox"  data-validatebox="validType:['required','maxLength[50]']"/> 
	     </div> -->
	     
	     
	     
	     
	 <div class="form-btn-wrapper" id="funcbar">
        <a class="btn btn-normal" id="backBtn">关闭</a>
     </div>
  </div>
  </div>
	
</form>
<script>
    var  permission = CommonUtil.getPermission('${name_english}');
    $(function () {
    	
    	//filePlugin("#fileList","#filePicker","#bannerImageUrls");
    	//filePlugin("#mainImageUrlFileList","#mainImageUrlFilePicker","#mainImageUrl");
    	//filePlugin("#detailImageUrlsFileList","#detailImageUrlsFilePicker","#detailImageUrls");
    	
    	filePlugin("#bannerImageUrls","#filePicker","#fileList");
    	filePlugin("#mainImageUrl","#mainImageUrlFilePicker","#mainImageUrlFileList");
    	filePlugin("#detailImageUrls","#detailImageUrlsFilePicker","#detailImageUrlsFileList");
    	
    	//初始化下拉选项
   	   /*$('#indexLocation').combobox({
           valueField : 'code',
           textField : 'name',
           url : COMMON_URL.getCode + '?type=T_MALL_INDEX_LOCATION'
       });*/
    	
     	//初始化下拉选项
   	   $('#isFreePost').combobox({
           valueField : 'code',
           defaultValue:"001",
           async:false,
           textField : 'name',
           url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
       });
     	
   	   //初始化下拉选项
   	   $('#isJingping').combobox({
           valueField : 'code',
           defaultValue:"002",
           async:false,
           textField : 'name',
           url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
       });
     	
     	//初始化下拉选项
   	   $('#isServenBack').combobox({
           valueField : 'code',
           defaultValue:"001",
           async:false,
           textField : 'name',
           url : COMMON_URL.getCode + '?type=T_DM_COMMON_YESORNOT'
       });
     	
     	
   	  //初始化下拉选项
   	   $('#laiyuan').combobox({
           valueField : 'id',
           async:false,
           textField : 'name',
           url : CONST_URL.COMPANYS
       });
     	
   	   //初始化下拉选项
   	   $('#productProperty0').combobox({
           valueField : 'id',
           textField : 'name',
           url : CONST_URL.PRODUCT_PROPERTYS,
           onSelect: function(record){
        	   //初始化下拉选项
           	   $('#productPropertyValue0').combobox({
           		   async:false,
                   valueField : 'id',
                   textField : 'propertyValue',
                   url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id
               });
        	   
           	   $('#productPropertyValue0').combobox('reload', CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id);

           }
       });
   	
   	
     	$('#funcbar').prepend($.funcbar({
            type: 'button',
            data: permission,
            permit: ['${name_english}:addc','${name_english}:add']
        }));
    	
    	//保存按钮
    	$('#funcbar').on('click', 'a[data-permit="${name_english}:add"]', {isContinue: false},  submit);
    	
    	//保存并添加按钮
    	$('#funcbar').on('click', 'a[data-permit="${name_english}:addc"]', {isContinue: true},  submitc);
    	
    	//返回按钮
    	$('#backBtn,#goBack').on('click',backMain);
    	
    });
    
    //var i=0;
    var k=0;
    function addProperty(){
    	var j=k;
    	k++;
    	$("#afterProperty"+j).after('<div class="form-cont" id="afterProperty'+k+'">'+
					    	        '<p class="form-cont-title">商品属性</p>'+
					    	        '<input type="text" id="productProperty'+k+'" name="productProperty'+k+'" class="summer-input"/>'+
					    	        '<input type="text" id="productPropertyValue'+k+'" name="productPropertyValue'+k+'" class="summer-input"/>'+ 
					    	        '<a onclick="removeProperty('+k+')"><img alt="" src="<%=request.getContextPath()%>/static/images/edit_remove.png"></a>'+
					    	     '</div>');
    	   //初始化下拉选项
    	   $('#productProperty'+k).combobox({
                valueField : 'id',
            	textField : 'name',
            	url : CONST_URL.PRODUCT_PROPERTYS,
            	onSelect: function(record){
            		//初始化下拉选项
                	 $('#productPropertyValue'+k).combobox({
                		   async:false,
                           valueField : 'id',
                           textField : 'propertyValue',
                           url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id
                    });
             	   
                	$('#productPropertyValue'+k).combobox('reload', CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id);
                }
         });
    	  
    }
    
    function removeProperty(index){
    	$("#afterProperty"+index).remove();
    	k--;
    }
    
    //表单提交
    function submit(event) {
    	
    	
    	 //var pro0 = $('#productProperty'+i).combobox("getValue");
    	 //var proV0 = $('#productProperty0').val();
    	 //var proValue0 = $("productPropertyValue0").va();
    	 if( $("#productProperty0").combobox("getValue") && $("#productPropertyValue0").combobox("getValue") ){
    		 var proVal0 = $('#productPropertyValue'+i).combobox("getValue");
    		// console.log($('#productProperty'+t).combobox("getValue"));
    	
    		 if( proVal0 ){
    			 var value = "";
    			
        		 for(var t=0;t<=k;t++){
        			// console.log(t,k);
        			
        				 value += $('#productProperty'+t).combobox("getValue");
            			 value += ":";
            	    	 value += $('#productPropertyValue'+t).combobox("getValue");
            	    	value += ",";
        			
        		 }
    			
    			 value=value.substring(0,value.length-1);
        		//console.log(value);
        		 $("#productPropertys").val(value);
    		 } 
    	 }
    	
          $("#addForm").form({
        	 buttons : ['#saveBtn','#saveBtnContinue'],
             ajax: {
                 url: CONST_URL.ADD
             },
             onSubmitSuccess: function (data) {
            	 $.stip({
  	                type:'ok',//显示类型 有info、 ok、 danger
  	                text: '保存成功！',
  	                onBeforeHide: function () {
  	            	  var isContinue = event.data.isContinue;
                   	  if (isContinue) {
                   		  //alert(data.data);
                   		  
                   		  $("#productId").val(data.data);
                   		  //将商品变为不可编辑
                          resetForm();
                   		  
                   	  } else {
                   		  backMain();
                   	  }
  	               }
              	});
              }
         }).form("submit"); 
    }
    
  //表单提交
    function submitc(event) {
	     
    	 if( $("#productProperty0").combobox("getValue") && $("#productPropertyValue0").combobox("getValue") ){
    		 var pro0 = $('#productProperty'+i).combobox("getValue");
        	 if( pro0 ){
        		 var proVal0 = $('#productPropertyValue'+i).combobox("getValue");
        		 if( proVal0 ){
        			 var value = "";
            		 for(var t=0;t<=k;t++){
            			
            				 value += $('#productProperty'+t).combobox("getValue");
                			 value += ":";
                	    	 value += $('#productPropertyValue'+t).combobox("getValue");
                	    	 value += ",";
            			 
            		 }
            		 value=value.substring(0,value.length-1);
            		 $("#productPropertys").val(value);
        		 }
        	 }
             $("#addForm").form({
            	 buttons : ['#saveBtn','#saveBtnContinue'],
                 ajax: {
                     url: CONST_URL.ADD
                 },
                 onSubmitSuccess: function (data) {
                	 $.stip({
      	                type:'ok',//显示类型 有info、 ok、 danger
      	                text: '保存成功！',
      	                onBeforeHide: function () {
      	            	  var isContinue = event.data.isContinue;
                       	  if (isContinue) {
                       		  //alert(data.data);
                       		  
                       		  $("#productId").val(data.data);
                       		  //将商品变为不可编辑
                              resetForm();
                       		  
                       	  } else {
                       		  backMain();
                       	  }
      	               }
                  	});
                  }
             }).form("submit");
    	 }else{
    		 $.stip({
	                type:'info',//显示类型 有info、 ok、 danger
	                text: '请选择一个款式再添加！'
        	 });
 		 return;
    	 }
    	 
    }
    
    //保存并继续清空form
    function resetForm(){
        $('#bannerUrls').val('');
        $("#isMainView").remove();
        $("#isMain").val("0");
        for(var t=i;t>0;t--){
        	removeProperty(t);
		}
        $('#productProperty0').combobox("clear");
   	    $('#productPropertyValue0').combobox("clear");
   	    
   	    $("#productOrginPrice").val('');
   	    //$("#productHongbao").val('');
   	 	//$("#productPrice").val('');
   	    $("#skuNum").val('');
    }
    
    //返回主页面
    function backMain() {
    	window.location.href = CONST_URL.INIT_LIST;
    	//window.location.href = CONST_URL.INIT_MAIN;
    	//parent.refreshList('${parentId}');
    }
    
    var u=0;
    function addSku(){
    	//判断当前有没有款式，没有则提示填写 
    	if($("#productProperty0").combobox("getValue") && $("#productPropertyValue0").combobox("getValue")){
    		 $("#afterSku").after('<div class="h4 distance-double">'+
    			        '<span class="h4-title"><i class="icon icon-setting"></i>新款 </span>'+
    			        '<span class="h4-border"></span>'+
    			    '</div>'+
    			    '<input type="hidden" id="'+u+'productPropertys" name="'+u+'productPropertys"/>'+
    				     '<div class="form-cont" id="'+u+'afterProperty0">'+
    				        '<p class="form-cont-title"><!-- <span class="field-required">*</span> -->商品属性</p>'+
    				        '<input type="text" id="'+u+'productProperty0" name="'+u+'productProperty0" class="summer-input"/>'+
    			            '<input type="text" id="'+u+'productPropertyValue0" name="'+u+'productPropertyValue0" class="summer-input"/>'+
    			            '<a onclick="addPropertySku('+u+')"><img src="<%=request.getContextPath()%>/static/images/edit_add.png"></a>'+
    				     '</div>'+
    				    
    				     '<div class="form-cont">'+
    				        '<p class="form-cont-title"><span class="field-required">*</span>库存</p>'+
    				        '<input type="text" id="'+u+'productInventory" name="'+u+'productInventory" class="summer-input" />'+ 
    				     '</div>'+
    				     '<div class="form-cont">'+
    				        '<p class="form-cont-title"><span class="field-required">*</span>商品价格</p>'+
    				        '<input type="text" id="'+u+'productOrginPrice" name="'+u+'productOrginPrice" class="summer-input"/>'+ 
    				     '</div>'+
    				     //'<div class="form-cont">'+
    				        //'<p class="form-cont-title"><span class="field-required">*</span>优惠红包</p>'+
    				       // '<input type="text" id="'+u+'productHongbao" name="'+u+'productHongbao" class="summer-input summer-validatebox"  data-validatebox="validType:[\'required\',\'maxLength[50]\']"/>'+ 
    				    // '</div>'+
    				     //'<div class="form-cont">'+
    				        //'<p class="form-cont-title"><span class="field-required">*</span>商品现价</p>'+
    				        //'<input type="text" id="'+u+'productPrice" name="'+u+'productPrice" class="summer-input summer-validatebox"  data-validatebox="validType:[\'required\',\'maxLength[50]\']"/>'+
    				    // '</div>'+
    				     '<div class="form-cont" id="afterSku">'+
    				        '<p class="form-cont-title"><span class="field-required">*</span>商家编码</p>'+
    				        '<input type="text" id="'+u+'skuNum" name="'+u+'skuNum" class="summer-input" />'+ 
    				     '</div>');
    		   //初始化下拉选项
		   	   $('#'+u+'productProperty0').combobox({
		           valueField : 'id',
		           textField : 'name',
		           url : CONST_URL.PRODUCT_PROPERTYS,
		           onSelect: function(record){
		        	   //初始化下拉选项
		           	   $('#'+u+'productPropertyValue0').combobox({
		           		   //async:false,
		                   valueField : 'id',
		                   textField : 'propertyValue',
		                   url : CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id
		               });
		        	   
		           	   $('#'+u+'productPropertyValue0').combobox('reload', CONST_URL.PRODUCT_PROPERTY_VALUES+"?propertyId="+record.id);
		
		           }
		       });
    		 
    		  u=u+1;
    	}else{
    		 $.stip({
	                type:'info',//显示类型 有info、 ok、 danger
	                text: '请选择一个款式,再添加！'
           	 });
    	}
    }    
    
    function addPropertySku(o){
    	alert(o);
    }
    
    function autoCreate(){
    	var date = new Date();
        var seperator1 = "";
        var seperator2 = "";
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                +  date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + date.getSeconds();
        //alert(currentdate);
        $("#skuNum").val(currentdate);
    }
   
    //请求url
    var CONST_URL = {
        INIT_LIST: basePath + "${common_url}initList?categoryId=${categoryId}",
    	INIT_MAIN: basePath + "${common_url}init",
    	PRODUCT_PROPERTYS: basePath + "${common_url}getProductPropertys",
    	PRODUCT_PROPERTY_VALUES: basePath + "${common_url}getProductPropertyValues",
    	COMPANYS: basePath + "${common_url}companys",
       	ADD: basePath + "${common_url}add"
    };
    
</script>
</body>
</html>